home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.Icon;
- import com.sun.java.swing.preview.filechooser.FileView;
- import java.io.File;
- import java.util.Hashtable;
-
- class BasicFileChooserUI$BasicFileView extends FileView {
- // $FF: synthetic field
- BasicFileChooserUI this$0;
- protected Hashtable iconCache;
-
- // $FF: synthetic method
- public BasicFileChooserUI$BasicFileView(BasicFileChooserUI this$0) {
- this.this$0 = this$0;
- this.iconCache = new Hashtable();
- }
-
- public void clearIconCache() {
- this.iconCache = new Hashtable();
- }
-
- public String getName(File f) {
- String fileName = null;
- if (f != null) {
- fileName = f.getName();
- if (fileName.equals("")) {
- fileName = f.getPath();
- }
- }
-
- return fileName;
- }
-
- public String getDescription(File f) {
- return f.getName();
- }
-
- public String getTypeDescription(File f) {
- return f.isDirectory() ? this.this$0.directoryDescription : this.this$0.fileDescription;
- }
-
- public Icon getCachedIcon(File f) {
- return (Icon)this.iconCache.get(f);
- }
-
- public void cacheIcon(File f, Icon i) {
- if (f != null && i != null) {
- this.iconCache.put(f, i);
- }
- }
-
- public Icon getIcon(File f) {
- Icon icon = this.getCachedIcon(f);
- if (icon != null) {
- return icon;
- } else {
- if (f != null && f.isDirectory()) {
- if (this.this$0.getFileChooser().getFileSystemView().isRoot(f)) {
- icon = this.this$0.hardDriveIcon;
- } else {
- icon = this.this$0.directoryIcon;
- }
- } else {
- icon = this.this$0.fileIcon;
- }
-
- this.cacheIcon(f, icon);
- return icon;
- }
- }
-
- public Boolean isTraversable(File f) {
- return f.isDirectory() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- public Boolean isHidden(File f) {
- String name = f.getName();
- return name != null && name.charAt(0) == '.' ? Boolean.TRUE : Boolean.FALSE;
- }
- }
-